<?php

if(stristr($_SERVER['PHP_SELF'],".inc.php")) { 
	header("Location:index.php"); 
	exit; 
}
	
if($_POST['op'] == "d" && isset($_pw)) {
	$_id = intval($_POST['u']);  
	remove_post($_id); 
	unset($goto); 
	$goto = $self."?m=d&id=".$_id;
	header("Location: ".$goto);
	exit; 
} else { 	
	$_hideForm = TRUE;
	$_hidePosts = TRUE; 
	$id = $_REQUEST['id'];
	$the = get_post($id); 

	$the['tImg'] = $the['img'];
	$the['tName'] = addslashes($the['name']);
	$the['tAlign'] = "left";
	$the['permalink_title'] = permalink_title($the['title']); 
	$the['publicPath'] = $publicPath; 
	
	#################### TEMPLATE #########################################
	$tmpl = $tmpldir."read.tmpl";
	if(phpversion() < 4.3) { 
		$html = implode ("", (file($tmpl)));
	} else { 
		$html = file_get_contents($tmpl);  
	}
	//this next bit generates the comment from the HTML template 
	foreach ($the as $key => $value) { 
		$mykey = '{' . $key . '}';
		$html = str_replace($mykey, $value, $html);
	}    
	echo $html;
	#################### END TEMPLATE #####################################	
	
	
?>
	<form action="<?php echo $self; ?>?" method="post" name="myform" style="padding-bottom:0px;">
	<input type="hidden" name="op" value="d" />
	<input type="hidden" name="u" value="<?php echo $the['id'];?>" />
	Are you <b>sure</b> you want to delete this item? <br />
	<input type="submit" name="delete" class="button" value="<?php echo ucwords($Lang['imSure']);?>" />&nbsp;&nbsp;
	<input type="button" name="cancel" class="button" value="<?php echo ucwords($Lang['noCancel']);?>" onclick="location.href='?'" />&nbsp;&nbsp;
	<br />
	</form>
	
<?php
}
?>